package com.ynkbny.service.impl;

import com.ynkbny.base.PageResult;
import com.ynkbny.domain.mongo.NotUploadDataLog;
import com.ynkbny.domain.mongo.NotUploadDataLogVO;
import com.ynkbny.service.NotUploadDataLogService;
import com.ynkbny.util.MongoUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @Author YY
 * @Date 2023/9/13 10:09
 **/
@Slf4j
@Service
public class NotUploadDataLogServiceImpl implements NotUploadDataLogService {

    @Resource
    private MongoUtil mongoUtil;

    /**
     * 分页查询
     *
     * @param notUploadDataLogVO 筛选条件
     * @return 查询结果
     */
    @Override
    public PageResult<NotUploadDataLog> pageQuery(NotUploadDataLogVO notUploadDataLogVO) {
        long count = mongoUtil.count(notUploadDataLogVO, NotUploadDataLog.class, "notUploadDataLog");
        List<NotUploadDataLog> logsList = mongoUtil.pageQuery(notUploadDataLogVO, NotUploadDataLog.class, "notUploadDataLog", Arrays.asList("statDate","date"));
        return new PageResult<>(logsList, count, notUploadDataLogVO.getPageNum(), notUploadDataLogVO.getPageSize());
    }
}